package threadTest.myAsync;

import org.springframework.scheduling.annotation.Async;

import java.util.List;

/**
 * 功能描述:异步能源服务实施
 * 2024/09/04
 *
 * @author ZhangYi
 */
public class AsyncEnergyServiceImpl {
	/**
	 * 异步获取子任务碳能源订单排放
	 *
	 * @author ZhangYi
	 */
//	@Async 如果只使用 Async 可能存在资源耗尽的危险
	@Async("threadPoolTaskExecutor")
//	public void asyncGetCarbonEnergyOrderEmissionForSubTasks(CarbonVerificationTask task, List<CarbonVerificationBoundaryTask> subTaskList) {
	public void asyncGetCarbonEnergyOrderEmissionForSubTasks() {

		System.out.println("获取组织能耗数据"+Thread.currentThread().getName());
		//		energyJobService.getCarbonEnergyEmissionForSubTasks(task, subTaskList);
//		energyJobService.getOrderEmission(task.getCycleTaskYear(), subTaskList);
	}


	/**
	 * 异步获取子任务设备发射
	 *
	 * @author ZhangYi
	 */
	@Async("threadPoolTaskExecutor")
//	public void asyncGetDeviceEmissionForSubTasks(LogisticsStationTask task, List<LogisticsStationBoundaryTask> subTaskList) {
	public void asyncGetDeviceEmissionForSubTasks() {
		System.out.println("获取设备能耗数据"+Thread.currentThread().getName());
//		energyJobService.getDeviceEmissionForSubTasks(task, subTaskList);
	}
}
